//
//  BaseMainViewController.m
//  MyCloudMusic
//
//  Created by pub on 2024/6/9.
//

#import "BaseMainViewController.h"
#import <UIViewController+CWLateralSlide.h>
#import "DrawerController.h"
@interface BaseMainViewController ()
@property(nonatomic, strong)DrawerController *drawerController;
@end

@implementation BaseMainViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (void)initViews{
    [super initViews];
    
    //[self setTitle:@"发现界面"];
    
    [self addRightImageButton:R.image.menu];
    
    [self addLeftImageButton:R.image.mic];
    
    _searchButton = [[QMUIButton alloc] init];
    _searchButton.myWidth = MyLayoutSize.fill;
    _searchButton.myHeight = 35;
    _searchButton.adjustsTitleTintColorAutomatically = YES;
    _searchButton.titleLabel.font = UIFontMake(14);
    _searchButton.tintColor = [UIColor black80];
    _searchButton.layer.cornerRadius = 17.5;
    [_searchButton setTitle:R.string.localizable.hintSearchValue forState:UIControlStateNormal];
    _searchButton.backgroundColor = [UIColor colorDivider];
    
    [_searchButton setImage:R.image.search forState:UIControlStateNormal];
    [_searchButton setImageEdgeInsets:UIEdgeInsetsMake(0, 0, 0, 5)];
    

    [self.toolbarView addcontentItem :_searchButton];
}

- (void)onSearchClick:(QMUIButton *)sender{
    
}

- (void)onLeftClick:(QMUIButton *)send{
    [self openDrawer];
}

- (DrawerController *)drawerController{
    if(_drawerController == nil){
        _drawerController = [DrawerController new];
    }
    return _drawerController;
}

- (void)openDrawer{
    //[self cw_showDefaultDrawerViewController:self.drawerController];
    [self cw_showDrawerViewController:self.drawerController animationType:CWDrawerAnimationTypeMask configuration:nil];
    
    
}

@end
